home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 18
/
aminetcdnumber181997.iso
/
Aminet
/
dev
/
amos
/
AMOSList_0197.lzh
/
AMOSLIST
/
000137_amos-request@svcs1.digex.net_Sat Jan 25 08:45:44 1997.msg
< prev
next >
Wrap
Internet Message Format
|
1997-02-02
|
2KB
Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
by mail2.access.digex.net (8.8.5/8.8.5) with ESMTP id IAA06453
for <mcox@access.digex.net>; Sat, 25 Jan 1997 08:45:42 -0500 (EST)
Received: (from daemon@localhost)
by svcs1.digex.net (8.8.5/8.8.5) id IAA15550
for amos-out; Sat, 25 Jan 1997 08:00:46 -0500 (EST)
Received: from mail1.access.digex.net (mail1.access.digex.net [205.197.247.2])
by svcs1.digex.net (8.8.5/8.8.5) with ESMTP id IAA15547
for <amos-list@svcs1.digex.net>; Sat, 25 Jan 1997 08:00:45 -0500 (EST)
Received: from red.paston.co.uk (red.paston.co.uk [194.129.188.3])
by mail1.access.digex.net (8.8.5/8.8.5) with ESMTP id IAA07179
for <amos-list@access.digex.net>; Sat, 25 Jan 1997 08:00:44 -0500 (EST)
Received: from paston.co.uk ([194.129.188.201]) by red.paston.co.uk with SMTP id <843245-28210>; Sat, 25 Jan 1997 12:59:27 -0000
From: Ben Wyatt <bwyatt@paston.co.uk>
To: amos-list@access.digex.net
Date: Sat, 25 Jan 1997 00:21:56 -0000
Message-ID: <yam6964.2840.4022152@194.129.188.3>
In-Reply-To: <9f5_9701240826@setnet.co.yu>
X-Mailer: YAM 1.3.4 [020] - Amiga Mailer by Marcel Beck
Subject: Re: goto
MIME-Version: 1.0
Content-Type: text/plain
Status: RO
X-Status:
On 24-Jan-97, Nikola Smolenski sat on a keyboard and produced this mess:
> gs> Do
> gs> Goto Rnd(4)
> gs> 0
> <bla>
> gs> 1
> <bla>
> gs> 2
> <bla>
> gs> 3
> <bla>
> gs> 4
> <bla>
> gs> Loop
> gs> How can I get the program to go to each label
> gs> only once? (randomly)
> I think this is the easiest:
> dim a(n)
> for i=1 to n
> a(i)=i
> next
> for i=1 to n
> r=rnd(n)+1
> goto r
> a(r)=a(n)
> dec n
> next
I can't follow the logic of that program, but this program will do what was
originally requested:
Dim a(4)
' Store the label numbers in an array
For n=0 To 4
a(n)=n
Next n
' Shuffle the array about, 25 times
For time=1 To 25
Swap a(Rnd(4)),a(Rnd(4))
Next time
' Go to each label in a random order
For n=0 To 4
Gosub a(n)
Next n
0 ... Return
1 ... Return
2 ... Return
3 ... Return
4 ... Return
Bye_______________________________
/ \
/ Ben Wyatt - bwyatt@paston.co.uk \
\ or b.wyatt@uea.ac.uk /
\_______________________________/ (c)1995-97 Very Interesting Signatures